<script setup lang="ts">
import {ref} from "vue";
import axios from "axios";

interface User {
  name: string;
  email: string;
  phone: string;
}

const user = ref<User | null>(null)
// 发送HTTP请求获取用户数据
const response = await axios.get<User>('https://jsonplaceholder.typicode.com/users/1')
// user.value = response.data;
console.log("response:",response)


</script>

<template>
  <div>
    <h1>用户信息4324</h1>
<!--    <div v-if="user">-->
<!--      <p><strong>姓名:</strong> {{ user.name }}</p>-->
<!--      <p><strong>邮箱:</strong> {{ user.email }}</p>-->
<!--      <p><strong>电话:</strong> {{ user.phone }}</p>-->
<!--    </div>-->
<!--    <div v-else>-->
<!--      <p>正在加载用户数据...</p>-->
<!--    </div>-->
  </div>

</template>

<style scoped>

</style>
